home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17926 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1013 b 

  1. Path: nntp1.best.com!donstarr
  2. From: super@donstarr.org (Don Starr)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Array pointer?
  5. Date: Thu, 18 Apr 96 04:08:03 GMT
  6. Organization: Best Internet Communications
  7. Message-ID: <4l4f73$1a8_004@donstarr.best.com>
  8. References: <DppIHL.MzF@on.bell.ca> <829513366snz@j-bg.demon.co.uk>
  9. NNTP-Posting-Host: donstarr.vip.best.com
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <829513366snz@j-bg.demon.co.uk>,
  13.        John Sargent <jb@j-bg.demon.co.uk> wrote:
  14. *
  15. * [OK stuff clipped]
  16. *
  17. *>         ; is this correct, too?
  18. *>         int *c3
  19. *>         
  20. *>         c3 = (a + 3 * sizeof(int) );
  21. *>         count << *c3;
  22. *> 
  23. *
  24. *          OK. you'll get the contents of a[3]  
  25.  
  26. No, you'll get the contents of a[ 3 * sizeof(int) ]. The compiler will handle 
  27. the sizeof when it does the pointer arithmetic.
  28.  
  29. *          a + 3 is the same as a + (3 * sizeof(int)) if a is an int *   
  30.  
  31. This statement seems to contradict the one above it that says "OK. you'll get 
  32. the contents of a[3]".
  33.  
  34. Don
  35.